<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %> 

<%String path = request.getContextPath();%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	
    <link href="<%=path %>/css/index.css" type="text/css" rel="stylesheet" />
    <link href="<%=path %>/css/base.css" type="text/css" rel="stylesheet" />
    
    <style type="text/css">
		
	</style>
	
	<script type='text/javascript' src='<%=path %>/dwr/interface/loginService.js'></script>
    <script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
    <script type='text/javascript' src='<%=path %>/dwr/util.js'></script>

    <script type="text/javascript">
        function login()
        {
           if(document.userLogin.userName.value=="")
           {
               alert("请输入账号");
               return;
           }
           if(document.userLogin.userPw.value=="")
           {
               alert("请输入密码");
               return;
           }
           document.getElementById("indicator").style.display="block";
           loginService.login(document.userLogin.userName.value,document.userLogin.userPw.value,1,callback);
        }
        
        function callback(data)
		{
		    document.getElementById("indicator").style.display="none";
		    if(data=="no")
		    {
		        alert("账号或密码错误");
		        var url="<%=path %>/qiantai/user/userLogin.jsp";
		        window.location.href=url;
		    }
		    if(data!="no")//返回的data就是用户的id
		    {
		        alert("通过验证,登录成功");
		        //window.location.reload();
		        var url="<%=path %>/index.action";
			    window.location.href=url;
		    }
		}
	</script>
	
	
</head>
  
<body>
	<div class="banner">
        <jsp:include flush="true" page="/qiantai/top.jsp"></jsp:include>
	</div>


    <div class="main01" style="margin-top: 10px;">
    	<!-- <h2>
            <span style="font-size: 18px;font-weight:900 ">用户登陆</span>
            <div class="right" style="font-size: 14px;">dd</div>
        </h2> -->
        <div class="goods">
        	<form action="<%=path %>/" name="userLogin" method="post">
							       <table width="100%" align="center" border="0" cellpadding="6" cellspacing="6">
										<tr align='center' style="height: 38px;">
										    <td width="15%" align="right">
										         账号：
										    </td>
										    <td width="85%" align="left">
										        <input type="text" name="userName" style="width: 300px;"/>
										    </td>
										</tr>
										<tr align='center' style="height: 38px;">
										    <td width="15%" align="right">
										         密码：
										    </td>
										    <td width="85%" align="left">
										        <input type="password" name="userPw" style="width: 300px;"/>
										    </td>
										</tr>
										<tr align='center' style="height: 38px;">
										    <td width="15%" align="right">
										        &nbsp;
										    </td>
										    <td width="85%" align="left">
										       <input type="button" value="提交" onclick="login()" style="width: 80px;"/>&nbsp; 
										       <input type="reset" value="重置" style="width: 80px;"/>&nbsp;
										       <img id="indicator" src="<%=path %>/img/loading.gif" style="display:none"/>
										    </td>
										</tr>
								 </table>
						      </form>    
        </div>
    </div>
    
    
    <br/>
    <div class="bottom" style="position:absolute;bottom:0px;">
        <jsp:include flush="true" page="/qiantai/down.jsp"></jsp:include>
    </div>
</body>
</html>
